/*题目：打印出杨辉三角形（要求打印出10行如下图）
            1
          1    1
        1    2    1
      1    3    3    1
    1    4    6    4    1
1    5    10    10    5    1
…………
*/
public class Exerise_33 {
    public static void main(String[] args) {
        int array[][] = new int[10][10];
        for (int i = 0; i < 10; i++) {
            array[i][i] = 1;
            array[i][0] = 1;
        }
        for (int i = 2; i < 10; i++) {
            for (int j =1; j < i; j++) {
                array[i][j]=array[i-1][j-1]+array[i-1][j];
            }
        }
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 2*(10-i)-1; j++) {
                System.out.print(" ");
            }
            for (int j = 0; j <=i ; j++) {
                System.out.print(array[i][j]+"   ");
            }
            System.out.println();
        }
    }
}
